package com.toby.ioc.profile;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @desc:
 * @author: toby
 * @date: 2019/7/20 20:34
 */
public class ProfileMain {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        //ctx.getEnvironment().setActiveProfiles("test","dev");
        ctx.register(ProfileConfig.class);
        ctx.refresh();
        printBeanName(ctx);
    }

    private static void printBeanName(AnnotationConfigApplicationContext ctx){
        for(String beanName:ctx.getBeanDefinitionNames()) {
            System.out.println("容器中的BeanName："+beanName);
        }
    }
}
